﻿using MicroCloud;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using System.Collections.Generic;
using Tsari.Mes.Plc.Data;
using Tsari.Mes.Plc.Extensions;

namespace Tsari.Mes.Apis.Areas.Admin.Controllers
{
    /// <summary>
    /// 管理-Plc配置信息
    /// </summary>
    [Description("管理-Plc配置信息")]
    [AllowAnonymous]
    public class PlcController: AdminControllerBase
    {
        /// <summary>
        /// 获取 设备服务
        /// </summary>
        protected IMesPlcService MesPlcService => ServiceProvider.GetService<IMesPlcService>();

        protected Dictionary<string, PlcTypeData[]> Dicts
        {
            get
            {
                return ServiceProvider.GetService<IConfiguration>().GetPlcTypeOption()?.Dicts;
            }
        }

        [HttpPost]
        [Description("获取Plc类别型号配置")]
        public AjaxResult GetPlcDicts()
        {
            return AjaxResult.Success(Dicts);
        }

    }
}
